<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // function foo(){
    //     setTimeout( ()=>{
    //         console.log(this)
    //     },100 )
    // }
    // foo();//window

    // function foo(){
    //     setTimeout( ()=>{
    //         console.log(arguments)
    //     })
    // }
    // foo(1,2,4,5);//其实是函数foo的arguments

    function Foo(){
      for(var  i = 0; i < 10; i++){
          console.log(i);
      }
      console.log("我是Foo作用域里的" + i)
    }
    Foo();

    var a = 2;
    function IIFE(){
      var a = 3 ;
      console.log("iife" + a);
    }
   var b = {
      test:++a
    }
    console.log("++a"+ a);
    IIFE();
    console.log(a);

    var obj = { a:1,
        b:4   }

    with(obj){
        a = 1;
        b = 2;
        C = 3;
    }

    console.log("C"+window.C);
    
    foo();
    
    function foo(){
        console.log("foo1" + 1)
    }
    //重复的var声明会被忽略掉 
    var foo = function(){
        console.log("foo2"+ 2)
    }
    // 出现在后面的函数声明还是可以覆盖前面的
    function foo(){
        console.log("foo3" +3)
    }

   


</script>
</html>